package com.googlecode.bpmcenter.model;
 
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
 
@Entity
@Table(name="BPM_SCHEDULE")
public class Schedule {
 
    private Long id;
    private Order order;
    private Status step;
    private String description;
    private String groupName;
    private UserInfo user;
    private Date scheduledStartDate;
    private Date scheduledEndDate;
    private Date startDate;
    private Date endDate;
 
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "ID")
    public Long getId() {
        return id;
    }
 
    public void setId(Long id) {
        this.id = id;
    }

  	@ManyToOne(targetEntity = Order.class, fetch = FetchType.EAGER)
  	@JoinColumn(name = "ORDER_ID")
		public Order getOrder() {
    	return order;
    }

		public void setOrder(Order order) {
    	this.order = order;
    }

		@ManyToOne(fetch=FetchType.EAGER)
		@JoinColumn(name="STEP")
		public Status getStep() {
    	return step;
    }

		public void setStep(Status step) {
    	this.step = step;
    }

		@Column(name = "DESCRIPTION")
		public String getDescription() {
    	return description;
    }

		public void setDescription(String description) {
    	this.description = description;
    }

		@Column(name = "GROUP_NAME")
		public String getGroupName() {
    	return groupName;
    }

		public void setGroupName(String groupName) {
    	this.groupName = groupName;
    }

		@ManyToOne(fetch=FetchType.EAGER)
		@JoinColumn(name="USER_ID")
		public UserInfo getUser() {
    	return user;
    }

		public void setUser(UserInfo user) {
    	this.user = user;
    }

		@Column(name = "SCHEDULED_START_DATE")
		public Date getScheduledStartDate() {
    	return scheduledStartDate;
    }

		public void setScheduledStartDate(Date scheduledStartDate) {
    	this.scheduledStartDate = scheduledStartDate;
    }

		@Column(name = "SCHEDULED_END_DATE")
		public Date getScheduledEndDate() {
    	return scheduledEndDate;
    }

		public void setScheduledEndDate(Date scheduledEndDate) {
    	this.scheduledEndDate = scheduledEndDate;
    }

		@Column(name = "START_DATE")
		public Date getStartDate() {
    	return startDate;
    }

		public void setStartDate(Date startDate) {
    	this.startDate = startDate;
    }

		@Column(name = "END_DATE")
		public Date getEndDate() {
    	return endDate;
    }

		public void setEndDate(Date endDate) {
    	this.endDate = endDate;
    }
		
    @Override
    public String toString() {
        StringBuffer strBuff = new StringBuffer();
        strBuff.append("id : ").append(getId());
        return strBuff.toString();
    }

}